package springbootdubbo.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RateLimiterProperties {
    //每个周期内，允许的请求数
    public static Long limitForPeriod;
    //每个周期的时长
    public static Long limitRefreshPeriod;
    //被限流时，阻塞等待的时长
    public static Long timeoutDuration;
    @Value("${ratelimiter.limitForPeriod}")
    public void setLimitForPeriod(Long limitForPeriod) {
        this.limitForPeriod = limitForPeriod;
    }
    @Value("${ratelimiter.limitRefreshPeriod}")
    public void setLimitRefreshPeriod(Long limitRefreshPeriod) {
        this.limitRefreshPeriod = limitRefreshPeriod;
    }
    @Value("${ratelimiter.timeoutDuration}")
    public void setTimeoutDuration(Long timeoutDuration) {
        this.timeoutDuration = timeoutDuration;
    }
}
